import ConfigMarks from "../config-marks.js";
import FactoryPolygons from "./factory-polygons.js";

export default {
	areaBorder(data) {
		return new mars3d.layer.GeoJsonLayer({
			name: "省界线图层",
			allowDrillPick: false,
			data,
			symbol: {
				type: "polyline",
				styleOptions: {
					// setHeight: ConfigMarks.baseHeight + 10,
					setHeight: -100,
					...FactoryPolygons.areaBorder.style(),
				}
			}
		})
	},
	planeLayerImg(rectangle, url) {
		return new mars3d.layer.ImageLayer({
			name: "图片叠加层",
			// extrudedHeight: ConfigMarks.baseHeight,
			// setHeight: ConfigMarks.baseHeight,
			url,
			rectangle
		});
	},
	planeImg(positions, image) {
		return new mars3d.graphic.PolygonEntity({
			positions,
			flyTo: true,
			style: {
				outline: false,
				extrudedHeight: ConfigMarks.baseHeight,
				setHeight: ConfigMarks.baseHeight,
				materialType: mars3d.MaterialType.Image,
				materialOptions: {
					image,
					repeat: new Cesium.Cartesian2(1, 1)
				}
			}
		})
	},
	planeGeoImg(data, image) {
		return new mars3d.layer.GeoJsonLayer({
			name: "图层面状",
			allowDrillPick: false,
			data,
			opacity: 1,
			symbol: {
				type: "polygon",
				styleOptions: {
					outline: false,
					extrudedHeight: ConfigMarks.baseHeight,
					setHeight: ConfigMarks.baseHeight,
					opacity: 1,
					materialType: mars3d.MaterialType.Image,
					materialOptions: {
						image,
						repeat: new Cesium.Cartesian2(1, 1)
					}
				}
			}
		});
	}
}
